package br.com.intelsys.iflow.jbpm;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmConfiguration;

import br.com.intelsys.bfactory.BFactory;
import br.com.intelsys.bfactory.FactoryManager;

public class IFlowJbpmSpring extends IFlowJbpmWrapper {
	private JbpmConfiguration jbpmConfiguration;
	
	private static final Log log = LogFactory.getLog(IFlowJbpmSpring.class);

	boolean openContext() {
		if (this.jbpmContext == null) {
			log.debug("Criando um contexto para o jBPM apartir da configuracao do spring");
			JbpmConfiguration jbpmConfigurationTmp = this.jbpmConfiguration.getInstance();
			jbpmContext = jbpmConfiguration.createJbpmContext();
		}
		return(this.jbpmContext != null);
	}

	public void setJbpmConfiguration(JbpmConfiguration jbpmConfiguration) {
		this.jbpmConfiguration = jbpmConfiguration;
	}
}
